﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Reflection;

namespace ANGF
{
    internal class ExceptionReporter
    {
        public static void reportException(Exception e, Form parent = null)
        {
            AssemblyCompanyAttribute asmcmp = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(e.TargetSite.Module.Assembly, typeof(AssemblyCompanyAttribute));
            string[] mynames = { "pie dey", "kirarin", "microsoft" };
            if (parent == null) Application.Run(new FormFatalWarn(e.ToString(), !mynames.Any(c => asmcmp.Company.ToLower().Contains(c))));
            else
            {
                var form = new FormFatalWarn(e.ToString(), !mynames.Any(c => asmcmp.Company.ToLower().Contains(c)));
                form.ShowDialog(parent);
            }
            System.Diagnostics.Process.GetCurrentProcess().Kill();
        }
    }
}
